Current File : /var/www/vinorea/modules/autoupgrade/views/assets/segment-facade-GjXxjz1z.js |
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
import{l as t}from"./segment-isodate-CDrC9DRV.js";import{c as e}from"./segment-analytics-next-B8n1BW-_.js";import{l as r}from"./segment-isodate-traverse-DVAtc24X.js";var i={},o={},n={},a={exports:{}};!function(t){function e(t){return function(e,r,i,n){var a,s=n&&function(t){return"function"==typeof t}(n.normalizer)?n.normalizer:o;r=s(r);for(var p=!1;!p;)u();function u(){for(a in e){var t=s(a);if(0===r.indexOf(t)){var i=r.substr(t.length);if("."===i.charAt(0)||0===i.length){r=i.substr(1);var o=e[a];return null==o?void(p=!0):r.length?void(e=o):void(p=!0)}}}a=void 0,p=!0}if(a)return null==e?e:t(e,a,i)}}function r(t,e){return t.hasOwnProperty(e)&&delete t[e],t}function i(t,e,r){return t.hasOwnProperty(e)&&(t[e]=r),t}function o(t){return t.replace(/[^a-zA-Z0-9\.]+/g,"").toLowerCase()}t.exports=e((function(t,e){if(t.hasOwnProperty(e))return t[e]})),t.exports.find=t.exports,t.exports.replace=function(t,r,o,n){return e(i).call(this,t,r,o,n),t},t.exports.del=function(t,i,o){return e(r).call(this,t,i,null,o),t}}(a);var s=a.exports,p=e&&e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(n,"__esModule",{value:!0});var u=p(s);function c(t,e){return function(){var r=this.traits(),i=this.properties?this.properties():{};return u.default(r,"address."+t)||u.default(r,t)||(e?u.default(r,"address."+e):null)||(e?u.default(r,e):null)||u.default(i,"address."+t)||u.default(i,t)||(e?u.default(i,"address."+e):null)||(e?u.default(i,e):null)}}n.default=function(t){t.zip=c("postalCode","zip"),t.country=c("country"),t.street=c("street"),t.state=c("state"),t.city=c("city"),t.region=c("region")};var d={};Object.defineProperty(d,"__esModule",{value:!0}),d.clone=void 0,d.clone=function t(e){if("object"!=typeof e)return e;if("[object Object]"===Object.prototype.toString.call(e)){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=t(e[i]));return r}return Array.isArray(e)?e.map(t):e};var f={};Object.defineProperty(f,"__esModule",{value:!0});var l={Salesforce:!0};f.default=function(t){return!l[t]};var y={},h=/\d{13}/;y.is=function(t){return h.test(t)},y.parse=function(t){return t=parseInt(t,10),new Date(t)};var v={},x=/\d{10}/;v.is=function(t){return x.test(t)},v.parse=function(t){var e=1e3*parseInt(t,10);return new Date(e)};var m=t,b=y,_=v,g=Object.prototype.toString;var j=function(t){return e=t,"[object Date]"===g.call(e)?t:function(t){return"[object Number]"===g.call(t)}(t)?new Date((r=t)<315576e5?1e3*r:r):m.is(t)?m.parse(t):b.is(t)?b.parse(t):_.is(t)?_.parse(t):new Date(t);var e,r};var I=e&&e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(o,"__esModule",{value:!0}),o.Facade=void 0;var F=I(n),O=d,P=I(f),w=I(j),M=I(s),D=I(r);function A(t,e){e=e||{},this.raw=O.clone(t),"clone"in e||(e.clone=!0),e.clone&&(t=O.clone(t)),"traverse"in e||(e.traverse=!0),t.timestamp="timestamp"in t?w.default(t.timestamp):new Date,e.traverse&&D.default(t),this.opts=e,this.obj=t}o.Facade=A;var k=A.prototype;function S(t){return O.clone(t)}k.proxy=function(t){var e=t.split("."),r=this[t=e.shift()]||this.obj[t];return r?("function"==typeof r&&(r=r.call(this)||{}),0===e.length||(r=M.default(r,e.join("."))),this.opts.clone?S(r):r):r},k.field=function(t){var e=this.obj[t];return this.opts.clone?S(e):e},A.proxy=function(t){return function(){return this.proxy(t)}},A.field=function(t){return function(){return this.field(t)}},A.multi=function(t){return function(){var e=this.proxy(t+"s");if(Array.isArray(e))return e;var r=this.proxy(t);return r&&(r=[this.opts.clone?O.clone(r):r]),r||[]}},A.one=function(t){return function(){var e=this.proxy(t);if(e)return e;var r=this.proxy(t+"s");return Array.isArray(r)?r[0]:void 0}},k.json=function(){var t=this.opts.clone?O.clone(this.obj):this.obj;return this.type&&(t.type=this.type()),t},k.rawEvent=function(){return this.raw},k.options=function(t){var e=this.obj.options||this.obj.context||{},r=this.opts.clone?O.clone(e):e;if(!t)return r;if(this.enabled(t)){var i=this.integrations(),o=i[t]||M.default(i,t);return"object"!=typeof o&&(o=M.default(this.options(),t)),"object"==typeof o?o:{}}},k.context=k.options,k.enabled=function(t){var e=this.proxy("options.providers.all");"boolean"!=typeof e&&(e=this.proxy("options.all")),"boolean"!=typeof e&&(e=this.proxy("integrations.all")),"boolean"!=typeof e&&(e=!0);var r=e&&P.default(t),i=this.integrations();if(i.providers&&i.providers.hasOwnProperty(t)&&(r=i.providers[t]),i.hasOwnProperty(t)){var o=i[t];r="boolean"!=typeof o||o}return!!r},k.integrations=function(){return this.obj.integrations||this.proxy("options.providers")||this.options()},k.active=function(){var t=this.proxy("options.active");return null==t&&(t=!0),t},k.anonymousId=function(){return this.field("anonymousId")||this.field("sessionId")},k.sessionId=k.anonymousId,k.groupId=A.proxy("options.groupId"),k.traits=function(t){var e=this.proxy("options.traits")||{},r=this.userId();for(var i in t=t||{},r&&(e.id=r),t)if(Object.prototype.hasOwnProperty.call(t,i)){var o=null==this[i]?this.proxy("options.traits."+i):this[i]();if(null==o)continue;e[t[i]]=o,delete e[i]}return e},k.library=function(){var t=this.proxy("options.library");return t?"string"==typeof t?{name:t,version:null}:t:{name:"unknown",version:null}},k.device=function(){var t=this.proxy("context.device");"object"==typeof t&&null!==t||(t={});var e=this.library().name;return t.type||(e.indexOf("ios")>-1&&(t.type="ios"),e.indexOf("android")>-1&&(t.type="android")),t},k.userAgent=A.proxy("context.userAgent"),k.timezone=A.proxy("context.timezone"),k.timestamp=A.field("timestamp"),k.channel=A.field("channel"),k.ip=A.proxy("context.ip"),k.userId=A.field("userId"),F.default(k);var N={},T={exports:{}};"function"==typeof Object.create?T.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:T.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}};var z=T.exports,G=e&&e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(N,"__esModule",{value:!0}),N.Alias=void 0;var q=G(z),C=o;function L(t,e){C.Facade.call(this,t,e)}N.Alias=L,q.default(L,C.Facade),L.prototype.action=function(){return"alias"},L.prototype.type=L.prototype.action,L.prototype.previousId=function(){return this.field("previousId")||this.field("from")},L.prototype.from=L.prototype.previousId,L.prototype.userId=function(){return this.field("userId")||this.field("to")},L.prototype.to=L.prototype.userId;var U={},V={};Object.defineProperty(V,"__esModule",{value:!0});var Y=/.+\@.+\..+/;V.default=function(t){return Y.test(t)};var E=e&&e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(U,"__esModule",{value:!0}),U.Group=void 0;var Z=E(z),B=E(V),H=E(j),J=o;function K(t,e){J.Facade.call(this,t,e)}U.Group=K,Z.default(K,J.Facade);var Q=K.prototype;Q.action=function(){return"group"},Q.type=Q.action,Q.groupId=J.Facade.field("groupId"),Q.created=function(){var t=this.proxy("traits.createdAt")||this.proxy("traits.created")||this.proxy("properties.createdAt")||this.proxy("properties.created");if(t)return H.default(t)},Q.email=function(){var t=this.proxy("traits.email");if(t)return t;var e=this.groupId();return B.default(e)?e:void 0},Q.traits=function(t){var e=this.properties(),r=this.groupId();for(var i in t=t||{},r&&(e.id=r),t)if(Object.prototype.hasOwnProperty.call(t,i)){var o=null==this[i]?this.proxy("traits."+i):this[i]();if(null==o)continue;e[t[i]]=o,delete e[i]}return e},Q.name=J.Facade.proxy("traits.name"),Q.industry=J.Facade.proxy("traits.industry"),Q.employees=J.Facade.proxy("traits.employees"),Q.properties=function(){return this.field("traits")||this.field("properties")||{}};var R={},W=e&&e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(R,"__esModule",{value:!0}),R.Identify=void 0;var X=o,tt=W(s),et=W(z),rt=W(V),it=W(j),ot=function(t){return t.trim()};function nt(t,e){X.Facade.call(this,t,e)}R.Identify=nt,et.default(nt,X.Facade);var at=nt.prototype;at.action=function(){return"identify"},at.type=at.action,at.traits=function(t){var e=this.field("traits")||{},r=this.userId();for(var i in t=t||{},r&&(e.id=r),t){var o=null==this[i]?this.proxy("traits."+i):this[i]();null!=o&&(e[t[i]]=o,i!==t[i]&&delete e[i])}return e},at.email=function(){var t=this.proxy("traits.email");if(t)return t;var e=this.userId();return rt.default(e)?e:void 0},at.created=function(){var t=this.proxy("traits.created")||this.proxy("traits.createdAt");if(t)return it.default(t)},at.companyCreated=function(){var t=this.proxy("traits.company.created")||this.proxy("traits.company.createdAt");if(t)return it.default(t)},at.companyName=function(){return this.proxy("traits.company.name")},at.name=function(){var t=this.proxy("traits.name");if("string"==typeof t)return ot(t);var e=this.firstName(),r=this.lastName();return e&&r?ot(e+" "+r):void 0},at.firstName=function(){var t=this.proxy("traits.firstName");if("string"==typeof t)return ot(t);var e=this.proxy("traits.name");return"string"==typeof e?ot(e).split(" ")[0]:void 0},at.lastName=function(){var t=this.proxy("traits.lastName");if("string"==typeof t)return ot(t);var e=this.proxy("traits.name");if("string"==typeof e){var r=ot(e).indexOf(" ");if(-1!==r)return ot(e.substr(r+1))}},at.uid=function(){return this.userId()||this.username()||this.email()},at.description=function(){return this.proxy("traits.description")||this.proxy("traits.background")},at.age=function(){var t=this.birthday(),e=tt.default(this.traits(),"age");return null!=e?e:t instanceof Date?(new Date).getFullYear()-t.getFullYear():void 0},at.avatar=function(){var t=this.traits();return tt.default(t,"avatar")||tt.default(t,"photoUrl")||tt.default(t,"avatarUrl")},at.position=function(){var t=this.traits();return tt.default(t,"position")||tt.default(t,"jobTitle")},at.username=X.Facade.proxy("traits.username"),at.website=X.Facade.one("traits.website"),at.websites=X.Facade.multi("traits.website"),at.phone=X.Facade.one("traits.phone"),at.phones=X.Facade.multi("traits.phone"),at.address=X.Facade.proxy("traits.address"),at.gender=X.Facade.proxy("traits.gender"),at.birthday=X.Facade.proxy("traits.birthday");var st={},pt=e&&e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(st,"__esModule",{value:!0}),st.Track=void 0;var ut=pt(z),ct=o,dt=R,ft=pt(V),lt=pt(s);function yt(t,e){ct.Facade.call(this,t,e)}st.Track=yt,ut.default(yt,ct.Facade);var ht=yt.prototype;ht.action=function(){return"track"},ht.type=ht.action,ht.event=ct.Facade.field("event"),ht.value=ct.Facade.proxy("properties.value"),ht.category=ct.Facade.proxy("properties.category"),ht.id=ct.Facade.proxy("properties.id"),ht.productId=function(){return this.proxy("properties.product_id")||this.proxy("properties.productId")},ht.promotionId=function(){return this.proxy("properties.promotion_id")||this.proxy("properties.promotionId")},ht.cartId=function(){return this.proxy("properties.cart_id")||this.proxy("properties.cartId")},ht.checkoutId=function(){return this.proxy("properties.checkout_id")||this.proxy("properties.checkoutId")},ht.paymentId=function(){return this.proxy("properties.payment_id")||this.proxy("properties.paymentId")},ht.couponId=function(){return this.proxy("properties.coupon_id")||this.proxy("properties.couponId")},ht.wishlistId=function(){return this.proxy("properties.wishlist_id")||this.proxy("properties.wishlistId")},ht.reviewId=function(){return this.proxy("properties.review_id")||this.proxy("properties.reviewId")},ht.orderId=function(){return this.proxy("properties.id")||this.proxy("properties.order_id")||this.proxy("properties.orderId")},ht.sku=ct.Facade.proxy("properties.sku"),ht.tax=ct.Facade.proxy("properties.tax"),ht.name=ct.Facade.proxy("properties.name"),ht.price=ct.Facade.proxy("properties.price"),ht.total=ct.Facade.proxy("properties.total"),ht.repeat=ct.Facade.proxy("properties.repeat"),ht.coupon=ct.Facade.proxy("properties.coupon"),ht.shipping=ct.Facade.proxy("properties.shipping"),ht.discount=ct.Facade.proxy("properties.discount"),ht.shippingMethod=function(){return this.proxy("properties.shipping_method")||this.proxy("properties.shippingMethod")},ht.paymentMethod=function(){return this.proxy("properties.payment_method")||this.proxy("properties.paymentMethod")},ht.description=ct.Facade.proxy("properties.description"),ht.plan=ct.Facade.proxy("properties.plan"),ht.subtotal=function(){var t=lt.default(this.properties(),"subtotal"),e=this.total()||this.revenue();if(t)return t;if(!e)return 0;if(this.total()){var r=this.tax();r&&(e-=r),(r=this.shipping())&&(e-=r),(r=this.discount())&&(e+=r)}return e},ht.products=function(){var t=this.properties(),e=lt.default(t,"products");return Array.isArray(e)?e.filter((function(t){return null!==t})):[]},ht.quantity=function(){return(this.obj.properties||{}).quantity||1},ht.currency=function(){return(this.obj.properties||{}).currency||"USD"},ht.referrer=function(){return this.proxy("context.referrer.url")||this.proxy("context.page.referrer")||this.proxy("properties.referrer")},ht.query=ct.Facade.proxy("options.query"),ht.properties=function(t){var e=this.field("properties")||{};for(var r in t=t||{})if(Object.prototype.hasOwnProperty.call(t,r)){var i=null==this[r]?this.proxy("properties."+r):this[r]();if(null==i)continue;e[t[r]]=i,delete e[r]}return e},ht.username=function(){return this.proxy("traits.username")||this.proxy("properties.username")||this.userId()||this.sessionId()},ht.email=function(){var t=this.proxy("traits.email")||this.proxy("properties.email")||this.proxy("options.traits.email");if(t)return t;var e=this.userId();return ft.default(e)?e:void 0},ht.revenue=function(){var t=this.proxy("properties.revenue"),e=this.event();return!t&&e&&e.match(/^[ _]?completed[ _]?order[ _]?|^[ _]?order[ _]?completed[ _]?$/i)&&(t=this.proxy("properties.total")),function(t){if(!t)return;if("number"==typeof t)return t;if("string"!=typeof t)return;if(t=t.replace(/\$/g,""),t=parseFloat(t),!isNaN(t))return t}(t)},ht.cents=function(){var t=this.revenue();return"number"!=typeof t?this.value()||0:100*t},ht.identify=function(){var t=this.json();return t.traits=this.traits(),new dt.Identify(t,this.opts)};var vt={},xt=e&&e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(vt,"__esModule",{value:!0}),vt.Page=void 0;var mt=xt(z),bt=o,_t=st,gt=xt(V);function jt(t,e){bt.Facade.call(this,t,e)}vt.Page=jt,mt.default(jt,bt.Facade);var It=jt.prototype;It.action=function(){return"page"},It.type=It.action,It.category=bt.Facade.field("category"),It.name=bt.Facade.field("name"),It.title=bt.Facade.proxy("properties.title"),It.path=bt.Facade.proxy("properties.path"),It.url=bt.Facade.proxy("properties.url"),It.referrer=function(){return this.proxy("context.referrer.url")||this.proxy("context.page.referrer")||this.proxy("properties.referrer")},It.properties=function(t){var e=this.field("properties")||{},r=this.category(),i=this.name();for(var o in t=t||{},r&&(e.category=r),i&&(e.name=i),t)if(Object.prototype.hasOwnProperty.call(t,o)){var n=null==this[o]?this.proxy("properties."+o):this[o]();if(null==n)continue;e[t[o]]=n,o!==t[o]&&delete e[o]}return e},It.email=function(){var t=this.proxy("context.traits.email")||this.proxy("properties.email");if(t)return t;var e=this.userId();return gt.default(e)?e:void 0},It.fullName=function(){var t=this.category(),e=this.name();return e&&t?t+" "+e:e},It.event=function(t){return t?"Viewed "+t+" Page":"Loaded a Page"},It.track=function(t){var e=this.json();return e.event=this.event(t),e.timestamp=this.timestamp(),e.properties=this.properties(),new _t.Track(e,this.opts)};var Ft={},Ot=e&&e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ft,"__esModule",{value:!0}),Ft.Screen=void 0;var Pt=Ot(z),wt=vt,Mt=st;function Dt(t,e){wt.Page.call(this,t,e)}Ft.Screen=Dt,Pt.default(Dt,wt.Page),Dt.prototype.action=function(){return"screen"},Dt.prototype.type=Dt.prototype.action,Dt.prototype.event=function(t){return t?"Viewed "+t+" Screen":"Loaded a Screen"},Dt.prototype.track=function(t){var e=this.json();return e.event=this.event(t),e.timestamp=this.timestamp(),e.properties=this.properties(),new Mt.Track(e,this.opts)};var At={},kt=e&&e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(At,"__esModule",{value:!0}),At.Delete=void 0;var St=kt(z),Nt=o;function Tt(t,e){Nt.Facade.call(this,t,e)}At.Delete=Tt,St.default(Tt,Nt.Facade),Tt.prototype.type=function(){return"delete"},function(t){var r=e&&e.__assign||function(){return r=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},r.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.Delete=t.Screen=t.Page=t.Track=t.Identify=t.Group=t.Alias=t.Facade=void 0;var i=o;Object.defineProperty(t,"Facade",{enumerable:!0,get:function(){return i.Facade}});var n=N;Object.defineProperty(t,"Alias",{enumerable:!0,get:function(){return n.Alias}});var a=U;Object.defineProperty(t,"Group",{enumerable:!0,get:function(){return a.Group}});var s=R;Object.defineProperty(t,"Identify",{enumerable:!0,get:function(){return s.Identify}});var p=st;Object.defineProperty(t,"Track",{enumerable:!0,get:function(){return p.Track}});var u=vt;Object.defineProperty(t,"Page",{enumerable:!0,get:function(){return u.Page}});var c=Ft;Object.defineProperty(t,"Screen",{enumerable:!0,get:function(){return c.Screen}});var d=At;Object.defineProperty(t,"Delete",{enumerable:!0,get:function(){return d.Delete}}),t.default=r(r({},i.Facade),{Alias:n.Alias,Group:a.Group,Identify:s.Identify,Track:p.Track,Page:u.Page,Screen:c.Screen,Delete:d.Delete})}(i);export{i as d};